1. Field of the Invention
The present invention relates to an apparatus and a method for converting a value object (VO), and more particularly, to an apparatus and a method for converting a VO for generating the VO from data stored in a file, or storing the VO in the file.
2. Discussion of Related Art
A system for gathering and backing up data generally records data in a file, and then reads out the data from the file in order to process work. In a system developed with an object oriented language such as Java, a Java VO (VO) has to be encoded to match a file format in order to store the Java VO in a file. Conversely, the system has to decode the data stored in the file in order to generate the Java VO from the data stored in the file.
Accordingly, conversion costs are incurred for recording the Java. VO in the file or generating the Java VO from the file. Particularly, in the case of processing a large amount of data on the order of megabytes or gigabytes, such as in a financial batch system, high costs are required for data conversion and overall system processing performance is degraded.
A conventional system converts all data which is stored or will be stored in a file in the process of converting a Java VO and data stored in the file. That is, the conventional system generates the Java VO after decoding every column of data in order to process one file record. Even when storing the Java VO in the file, the conventional system encodes every field to generate the data. In this case, even when only a portion of the field is used in a practical work logic, since encoding and decoding have to be performed even for a remaining unused portion of the field, unnecessary operation costs are incurred. In order to overcome these problems, a developer can devise a program to only convert the practical used portion of the data in detail, but the amount and complexity of development required becomes too great and productivity is lowered.
Meanwhile, in order to generate a Java VO in a file or record the Java VO in the file, layout information of each column in the file, data type information of corresponding columns, and so on are needed. Further, based on the information, a task of dividing a record into columns and converting each column into a Java data type to correspond to a field of the Java VO, and conversely, a task of converting the field of the Java VO into record information matching the layout information of each column, are needed. A module of a system for performing these tasks is referred to as a mapper, and there are a general reflection mapper and a custom mapper.
The general reflection mapper sets a field name of the Java VO and column layout information corresponding to each field in the mapper, after this, calls and links a setter method of the Java VO based on the field name using the Java reflection. Various Java VOs can be processed with one mapper class.
The custom mapper exclusively configures a mapper embedding the column layout information in each Java VO, and explicitly calls and links a getter method and a setter method of the Java VO. Since the custom mapper explicitly calls a method of the Java VO, the custom mapper has a high speed.
However, calling a method using reflection of the general reflection mapper is slow and inconvenient because additional layout information has to be provided, compared with calling an explicit method of the custom mapper. On the other hand, the method using the mapper class of the custom mapper is fast but work is increased since an exclusive mapper class for each Java VO has to be further developed.
A system and method of mapping between a software object and structured language element-based documents are disclosed in Korean Patent No. 0583517, related to the present invention. The disclosed mapping system provides a common framework for mapping between the documents and the software object.
However, when only a portion of a practical work logic is used, encoding and decoding are still performed for a remaining unused field, and thus unnecessary operation costs are incurred.